package com.example.wendao.model.service;

import androidx.lifecycle.LiveData;
import androidx.paging.DataSource;

import com.example.wendao.model.db.dao.ForumPicsDao;
import com.example.wendao.model.db.database.AppDatabase;
import com.example.wendao.model.entity.Fans;
import com.example.wendao.model.entity.ForumPics;

import java.util.List;

public class ForumPicsService {

    ForumPicsDao forumPicsDao;

    public ForumPicsService() {
        forumPicsDao= AppDatabase.getDatabases().getForumPicsDao();
    }

    //插入论坛图片
    public void insertForumPic(ForumPics... forumpics) {
        forumPicsDao.insertForumPic(forumpics);
    }


        //根据论坛id查找论坛的图片
    public DataSource.Factory<Integer, ForumPics> findForumPicsByFatherId(int forumpicfatherid) {
        return forumPicsDao.findForumPicsByFatherId(forumpicfatherid);
    }


        //根据论坛id查找封面
        public ForumPics findForumPicsCoverByFatherId(int forumpicfatherid) {
            return forumPicsDao.findForumPicsCoverByFatherId(forumpicfatherid);
        }


        //更新论坛图片
        public void updateForumPics(ForumPics... forumpics) {
            forumPicsDao.updateForumPics(forumpics);
        }


        //删除论坛图片
        public void deleteForumPics(ForumPics... forumpics) {
            forumPicsDao.deleteForumPics(forumpics);
        }

}
